<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('customer_id');  // 充值用户id
            $table->string('order_no', 50)
                  ->comment('订单号');          // 订单号
            $table->bigInteger('amount')
                  ->comment('金额');            // 充值金额
            $table->string('subject')
                  ->comment('备注');            // 主题、备注
            $table->boolean('success')
                  ->default(false)
                  ->comment('充值成功与否');     // 充值成功与否
            $table->timestamp('created_at');    // 充值时间
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
